home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 2 / ETO Development Tools 2.iso / Tools - Objects / MacsBug / MacsBug 6.1 / dcmds / Pascal Samples / dcmd.p next >
Encoding:
Text File  |  1989-04-21  |  5.8 KB  |  135 lines  |  [TEXT/MPS ]

  1. {    dcmd.p
  2.   This is the dcmd interface.
  3.      Copyright © 1988 Apple Computer, Inc.  All rights reserved.
  4. }
  5.  
  6. UNIT dcmd;
  7.  
  8. INTERFACE
  9.  
  10.         CONST { Possible requests from the debugger to the command }
  11.                                 dcmdInit = 0;
  12.                                 dcmdDoIt = 1;
  13.                                 dcmdHelp = 2;
  14.         
  15.                                 D0Register   = 0;
  16.                                 D1Register   = 1;
  17.                                 D2Register   = 2;
  18.                                 D3Register   = 3;
  19.                                 D4Register   = 4;
  20.                                 D5Register   = 5;
  21.                                 D6Register   = 6;
  22.                                 D7Register   = 7;
  23.  
  24.                                 A0Register   = 8;
  25.                                 A1Register   = 9;
  26.                                 A2Register   = 10;
  27.                                 A3Register   = 11;
  28.                                 A4Register   = 12;
  29.                                 A5Register   = 13;
  30.                                 A6Register   = 14;
  31.                                 A7Register   = 15;
  32.  
  33.                                 PCRegister   = 16;
  34.                                 SRRegister   = 17;        { SR is only 16 bits and is stored in the high word }
  35.         
  36.               freeBlock           = 0;
  37.                                 nonrelocatableBlock = 1;
  38.                                 relocatableBlock    = 2;
  39.  
  40.         TYPE RegFilePtr   = ^RegFile;
  41.                             RegFile      = ARRAY [0..17] OF LONGINT;
  42.         
  43.                             dcmdBlockPtr = ^dcmdBlock;
  44.                             dcmdBlock    = RECORD
  45.                                                                                         registerFile: RegFilePtr;
  46.                                                                                         request:      INTEGER;
  47.                                                                                         aborted:      BOOLEAN;     { Set to true if the user types a key while scrolling }
  48.                                                                                         END;
  49.  
  50.   { Pacsal declarations for debugger call back routines that can be used by a dcmd }
  51.  
  52.   { Draw the text in the Pascal string as one or more lines separated by CR's.
  53.           Each line causes the MacsBug display to be scrolled and the new line to be
  54.                 drawn at the bottom. If the user types a key while scrolling then the aborted
  55.                 flag is set telling the command to terminate immediately. }
  56.         PROCEDURE dcmdDrawLine (str: Str255);
  57.  
  58.   { Draw the text in the Pascal string as a continuation of the current line. }
  59.         PROCEDURE dcmdDrawString (str: Str255);
  60.  
  61.   { Display the Pascal string in the command line area and wait for a key to be pressed.
  62.           Return TRUE if the user typed Return. All other keys return FALSE. MacsBug saves this
  63.                 key and adds it to the command line once the current command completes. Typing any
  64.                 key other than Return sets the aborted flag and tells the command to terminate immediately. }
  65.         FUNCTION dcmdDrawPrompt (str: Str255) : BOOLEAN;
  66.  
  67.   { Get the current command line position }
  68.         FUNCTION dcmdGetPosition : INTEGER;
  69.         
  70.         { Set the current command line position. This should only be set to a value returned 
  71.           by dcmdGetPosition. }
  72.         PROCEDURE dcmdSetPosition (pos: INTEGER);
  73.  
  74.   { Return the next character on the command line or CR if the entire line has been scanned }
  75.         FUNCTION dcmdGetNextChar : CHAR;
  76.         
  77.   { Return the next character on the command line or CR if the entire line has been scanned.
  78.           However, the current command line position is not changed. }
  79.         FUNCTION dcmdPeekAtNextChar : CHAR;
  80.         
  81.   { Copy all characters from the command line to the parameter string until a delimiter
  82.           is found or the end of the command line is reached. A delimiter is either a space,
  83.                 a comma or a CR. Both single and double quoted strings are allowed on the command
  84.                 line. However, the leading and trailing quotes must be of the same type. The parameter
  85.                 string is returned without the quotes. This function returns the delimiter }
  86.         FUNCTION dcmdGetNextParameter (VAR str: Str255) : CHAR;
  87.  
  88.   { Parse the command line for the next expression. All expressions are evaluated to 32 bits.
  89.           This function returns the delimiter after the expression. The possible delimiters are
  90.                 space, comma and CR.  Space is    not treated as a delimiter in the middle of expressions.
  91.                 For instance, '1 + 2' will return    a value of 3 and the delimiter will be the char following
  92.                 the 2. The return parameter 'ok' tells if the expression was parsed successfully. }
  93.         FUNCTION dcmdGetNextExpression (VAR value: LONGINT; VAR ok: BOOLEAN) : CHAR;        
  94.  
  95.         { Copy the break message MacsBug displayed the last time it was entered into str.
  96.                 This may contain multiple lines separated by CR's. }
  97.         PROCEDURE dcmdGetBreakMessage  (VAR str: Str255);
  98.         
  99.         { Return a symbolic representation for address in str. If no symbol can be found
  100.                 then an empty string is returned. The format of the symbol returned is Name+0000.
  101.                         With the new compilers, the name is no longer restricted to 8 characters. }
  102.         PROCEDURE dcmdGetNameAndOffset (address: LONGINT; VAR str: Str255);
  103.  
  104.   { Return the trap name for the trap number. If no symbol can be found
  105.                 then an empty string is returned. }
  106.         PROCEDURE dcmdGetTrapName (trapNumber: INTEGER; VAR trapName: Str255);
  107.  
  108.   { When a debugger command is called, the debugger's world (low memory) is installed.
  109.           Commands that want to reference the user's world can swap back and forth between the
  110.                 two worlds by making this call. This procedure does nothing in MacsBug. It is included
  111.                 to support other debuggers that might want to take advantage of it. }
  112.   PROCEDURE dcmdSwapWorlds;
  113.  
  114.   { Toggle between the user and debugger displays.
  115.           The first call restores the user's actual screen.
  116.           The second call restores the debugger's screen. }
  117.         PROCEDURE dcmdSwapScreens;
  118.  
  119.   { Walk thru the blocks in the current heap, calling DoThis for each block. DoThis should
  120.           be a procedure of the form:
  121.                 
  122.             PROCEDURE DoThis (blockAddress, blockLength, addrOfMasterPtr: LONGINT;
  123.                                           blockType: INTEGER;
  124.                               locked, purgeable, resource: BOOLEAN);
  125.  
  126.           The blockAddress and blockLength pertain to the data in the heap block, not including
  127.                 the block header. The addrOfMasterPtr is the master pointer's location in the heap,
  128.                 not the value of the master ptr. The blockType is defined by the constants freeBlock,
  129.                 nonrelocatableBlock and relocatableBlock. The booleans locked, purgeable and resource
  130.                 reflect the state of the block.    }
  131.   PROCEDURE dcmdForAllHeapBlocks (DoThis: ProcPtr);
  132.  
  133. IMPLEMENTATION
  134.  
  135. END.